<?php
// @formatter:off
/**
 * @file index.php
 * @author Alejandro Dario Simi
 * @date $Date: 2013-03-31 09:33:18 +0000 (Sun, 31 Mar 2013) $
 *
 * $Id: index.php 60 2013-03-31 09:33:18Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/tags/wcomix-1.0.0.1/index.php $
 */
// @formatter:on

require_once dirname(__FILE__).'/config/defines.php';

$isMobile = (isset($_COOKIE[WC_COOKIE_MOBILE_MODE]) && $_COOKIE[WC_COOKIE_MOBILE_MODE] == "ON");

define($isMobile ? "__MOBILE__" : "__INDEX__", true);

require_once dirname(__FILE__).'/config/config.php';

if(defined("WC_NOT_INSTALLED")) {
	require_once "{$wcPaths['install-directory']}/not-installed.php";
} else {
	$timer = WCTimer::Instance();
	$timer->startGlobal();

	if(!isset($_REQUEST['group']) && $wcDefaults['group'] !== false) {
		$_REQUEST['group'] = $wcDefaults['group'];
	}

	require_once "{$wcPaths['includes-directory']}/dynamic.conf.php";
	require_once "{$wcPaths['includes-directory']}/tools.php";

	$cacheId = $isMobile ? "MOBILE" : "INDEX";
	if($wcPageCache->get($cacheId) === false) {
		if($isMobile) {
			startMobileTheme();
		} else {
			startTheme();
		}

		$parser = $wcTheme->parser();

		$parser->massiveAssign($wcThemeAssigns);
		$parser->noWarnings();
		$parser->noSummary();

		$wcPageCache->append($cacheId, $parser->parse());
		$wcPageCache->save($cacheId);
	}

	echo $wcPageCache->get($cacheId);

	$timer->saveGlobal($cacheId);
}
?>
